<script language="javascript" src="/plugin/jquery/ajaxfileupload.js"></script>
<script language="javascript">
   function uploadgoodsimg()
    {
        //starting setting some animation when the ajax starts and completes
        $("#loading")
        .ajaxStart(function(){
            $(this).show();
        })
        .ajaxComplete(function(){
            $(this).hide();
        });

        $.ajaxFileUpload
        (
            {
                url:'/index.php?m=upload&a=uploadtao&dir=water&t='+Math.random(), 
                secureuri:false,
                fileElementId:'upimg',
                dataType: 'json',
                success: function (data, status)
                {
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                           alert(data.msg);
                        }else
                        {
                             $("#imgShow").html("<img src='/"+data.imgurl+".100x100.jpg' width='100'>");
							 $("#imgurl").val(data.imgurl);
                        }
                    }
                },
                error: function (data, status, e)
                {
					alert(data.msg)
  
                }
            }
        )
        
        return false;

    }
</script>
<table class="table table-bordered">

            <tr>
    <td height="30" align="right">开启水印：</td>
    <td height="30"><input name="water_on" type="radio" id="radio" value="1" {if $data.water_on eq 1} checked="checked" {/if} />开启 
        <input type="radio" name="water_on" id="radio2" value="0" {if $data.water_on eq 0} checked="checked" {/if} />关闭</td>
  </tr>
  <tr>
    <td width="156" height="30" align="right">水印类型：</td>
    <td width="581" height="30"><input name="water_type" type="radio" id="radio3" value="0" {if $data.water_type eq 0} checked="checked" {/if}/>图片水印 
        <input type="radio" name="water_type" id="radio4" value="1"  {if $data.water_type eq 1} checked="checked" {/if} />文字水印</td>
  </tr>
  <tr>
    <td height="30" align="right">水印位置：</td>
    <td height="30">
    <select name="water_pos" id="water_pos">
    <option value="9" {if $data.water_pos eq 9} selected="selected"{/if}>右下</option>
    <option value="0" {if $data.water_pos eq 0} selected="selected"{/if}>随机</option>
    <option value="1" {if $data.water_pos eq 1} selected="selected"{/if}>左上</option>
    <option value="2" {if $data.water_pos eq 2} selected="selected"{/if}>中上</option>
    <option value="3" {if $data.water_pos eq 3} selected="selected"{/if}>右上</option>
    <option value="4" {if $data.water_pos eq 4} selected="selected"{/if}>左中</option>
    <option value="5" {if $data.water_pos eq 5} selected="selected"{/if}>中中</option>
    <option value="6" {if $data.water_pos eq 6} selected="selected"{/if}>右中</option>
    <option value="7" {if $data.water_pos eq 7} selected="selected"{/if}>左下</option>
    <option value="8" {if $data.water_pos eq 8} selected="selected"{/if}>中下</option>
    </select></td>
  </tr>
  <tr>
    <td height="30" align="right">文字大小：</td>
    <td height="30"><input name="water_size" type="text" id="water_size" size="8" value="{$data.water_size}" />
      px</td>
  </tr>
  <tr>
    <td height="30" align="right">水印文字：</td>
    <td height="30"><input name="water_str" type="text" id="water_str" size="40" value="{$data.water_str}" /></td>
  </tr>
  <tr>
    <td height="30" align="right">水印图片：</td>
    <td height="30"><div class="btn-upload">
      <input type="file" name="upimg" class="btn-upload-file" id="upimg" onChange="uploadgoodsimg()">
      </div>
      <label  id="loading" style="color:red; display:none;">正在上传中...</label>
      <input type="hidden" name="water_img" id="imgurl" value="{$data.water_img}">
      <span id="imgShow">
      {if $data.water_img}
      <img src="/{$data.water_img}.100x100.jpg">
      {/if}
      </span></td>
  </tr>
</table>